import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: "./", //打包路径
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"), //设置别名
    },
  },
  server: {
    open: true, //启动项目自动弹出浏览器
    port: 5173, //启动端口
    proxy: {
      "/api": {
        // target: "https://192.168.2.111:8445",
        // target: "https://a725827c01.yicp.fun/hxt-bms",
        target: "https://bms.hxtetc.com/hxt-bms/",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
  //   server: {
  //     port: 5173,//启动端口
  //     open: true,
  //     proxy: {
  //       // 跨域简单写法写法
  //       '/api': 'http://192.168.10.168:8082'//代理网址
  //     },
  //     cors: true
  //   },
});
